home *** CD-ROM | disk | FTP | other *** search
- Program Delay;
-
- { PARAMS.PAS by Paul Klarreich, Brooklyn, NY }
-
- { Find the parameter string. In any MS-DOS program file, it is
- found at offset $80 in the program segment prefix -- the first
- $100 bytes of the program segment. The byte at $80 gives the
- length of the string and the next <length> bytes are the actual
- characters. }
-
- { NOTE: This program is meaningless unless compiled to a COM-file or
- the parameter variable is set in the options mode of turbo. }
-
- { Used to create a delay loop by Claire A. Rinehart, Madison, WI. }
-
- Type
- Str80 = string[80];
-
- Var
- CmdStr: String[80] Absolute CSeg:$0080; {command string}
- Millisec : integer; {time variable for delay}
- STime : string[80]; {string containing the time}
- ErrCode : integer;
-
- Procedure Parse(Var Line : Str80; Var Word : Str80; Delim : Char);
- {Removes first word in Line and returns it in Word. Line is modified so that
- it no longer has leading blanks before the word is filled. The delim constant
- is used to identify the symbol used to delimit words. The Line variable is
- decreased in length by one word, and of course leading blanks, before it is
- returned. Written by Claire A. Rinehart, Madison, WI. }
- Const
- Space = ' ';
- Var
- Indx, Len : Integer;
- Begin
- While Pos(Space, Line) = 1 Do {remove leading blanks}
- Delete(Line, 1, 1);
- Len := Pos(Delim, Line);
- If Len = 0 then
- begin {no delimiters left}
- Word := Line;
- Line := '';
- End
- Else If Len = 1 then
- begin {check for two delimiters in a row}
- Word := ''; {return null string}
- Delete(Line, 1, Len); {delete delimiter}
- End
- Else
- Begin {get word and delete from line}
- Word := Copy(Line, 1, Len -1); {get all but delimiter}
- Delete(Line, 1, Len); {delete word plus delimeter}
- End
- End; {of Parse}
-
-
- Begin
- Parse(CmdStr, STime, ' ');
- Val(STime, Millisec, ErrCode);
- Delay(Millisec);
- End.
-